<%@ Page Title="" Language="C#" MasterPageFile="~/WebForm/MasterPage.master" AutoEventWireup="true"
    CodeFile="ManageRole.aspx.cs" Inherits="WebForm_ManageRole_ManageRole" %>

<%@ Register src="OpenManageRoleProgramMapping.ascx" tagname="OpenManageRoleProgramMapping" tagprefix="uc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
 <div align="right">
    <asp:HyperLink ID="hlinkDescription" SkinID="Description" runat="server" NavigateUrl="~/Public/Description/ManageRole.html"></asp:HyperLink>
</div>
            <asp:Panel ID="Panel1" runat="server" 
    GroupingText="<%$ Resources:AddNewRole %>">
                <asp:FormView ID="FormView1" runat="server" DefaultMode="Insert" Width="100%">
                    <InsertItemTemplate>
                        <table cellpadding="5" cellspacing="5">
                            <tr>
                                <td>
                                    <asp:Label ID="lblParent" runat="server" Text="<%$ Resources:Parent %>"></asp:Label>
                                </td>
                                <td width="20%">
                                    <TServerControl:TDropDownList ID="ddlParent" runat="server" DataSourceID="ObjectDataSource_SelectAllPapas"
                                DataTextField="RoleName" DataValueField="RoleID" AutoPostBack="True" 
                                        onselectedindexchanged="ddlRolePapas_SelectedIndexChanged">
                                    </TServerControl:TDropDownList>
                                    <asp:ObjectDataSource ID="ObjectDataSource_SelectAllPapas" runat="server" 
                                        OldValuesParameterFormatString="original_{0}" SelectMethod="BLL_SelectAllRoles" 
                                        TypeName="BLL_ManageRole"></asp:ObjectDataSource>
                                </td>
                                <td>
                                    <asp:Label ID="lblRoleName" runat="server" Text="<%$ Resources:RoleName %>"></asp:Label>
                                </td>
                                <td width="23%">
                                    <asp:TextBox ID="txtRoleName" runat="server" MaxLength="50" Width="95%"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="chk_txtRoleName" runat="server" 
                                        ControlToValidate="txtRoleName" Display="None" 
                                        ErrorMessage="<%$ Resources:chk_txtRoleName %>" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                </td>
                                <td>
                                    <asp:Label ID="lblRoleDescription" runat="server" 
                                Text="<%$ Resources:RoleDescription %>"></asp:Label>
                                </td>
                                <td width="23%" style="margin-left: 40px">
                                    <asp:TextBox ID="txtRoleDescription" runat="server" MaxLength="50" 
                                Width="95%"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="chk_txtRoleDescription" runat="server" 
                                        ControlToValidate="txtRoleDescription" Display="None" 
                                        ErrorMessage="<%$ Resources:chk_txtRoleDescription %>" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                </td>
                                <td>
                                    <asp:ImageButton ID="btnAdd" ImageUrl="~/images/image/but_07.jpg" OnClick="btnAdd_Click" ValidationGroup="Insert" runat="server" />
                                </td>
                            </tr>
                        </table>
                    </InsertItemTemplate>
                </asp:FormView>
            </asp:Panel>
            <TServerControl:TGridView ID="TGridView1" runat="server" AllowHoverEffect="True"
        AllowHoverSelect="True" DataSourceID="ObjectDataSource_Role" ShowFooterWhenEmpty="False"
        ShowHeaderWhenEmpty="False" TotalRowCount="0" 
    AutoGenerateColumns="False" DataKeyNames="RoleID"
        SkinID="pager" onrowupdating="TGridView1_RowUpdating" 
                onrowdatabound="TGridView1_RowDataBound" 
                onrowupdated="TGridView1_RowUpdated">
                <Columns>
                    <asp:TemplateField>
                        <EditItemTemplate>
                            <asp:LinkButton ID="lbtnUpdate" runat="server" Text="<%$ Resources:Update %>" ValidationGroup="Update"
                        CommandName="Update"></asp:LinkButton>
                            <asp:LinkButton ID="lbtnCancel" runat="server" Text="<%$ Resources:Cancel %>" CommandName="Cancel"
                        CausesValidation="False"></asp:LinkButton>
                            &nbsp;
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnEdit" runat="server" Text="<%$ Resources:Edit %>" CommandName="Edit"
                        CausesValidation="False" Visible='<%# BooleanConverter(Eval("CanEdit")) %>'></asp:LinkButton>
                            &nbsp;<asp:LinkButton ID="lbtnDelete" runat="server" CausesValidation="False" 
                                CommandName="Delete" onclientclick="<%$ Resources:DeleteConfirm %>" 
                                Text="<%$ Resources:Delete %>" 
                                Visible='<%# BooleanConverter(Eval("CanEdit")) %>'></asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="ParentName" 
                HeaderText="<%$ Resources:Parent %>" SortExpression="ParentName"
                ReadOnly="True" >
                    <ItemStyle Width="22%" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="<%$ Resources:RoleName %>" 
                SortExpression="RoleName">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtRoleName0" runat="server" Text='<%# Bind("RoleName") %>' 
                        MaxLength="50" Width="90%"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="chk_txtRoleName0" runat="server" 
                                ControlToValidate="txtRoleName0" Display="None" 
                                ErrorMessage="<%$ Resources:chk_txtRoleName %>" ValidationGroup="Update"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("RoleName") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="22%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:RoleDescription %>" 
                SortExpression="RoleDescription">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtRoleDescription0" runat="server" 
                        Text='<%# Bind("RoleDescription") %>' MaxLength="50" Width="90%"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="chk_txtRoleDescription0" runat="server" 
                                ControlToValidate="txtRoleDescription0" Display="None" 
                                ErrorMessage="<%$ Resources:chk_txtRoleDescription %>" ValidationGroup="Update"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("RoleDescription") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="22%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Active %>" SortExpression="Active">
                        <EditItemTemplate>
                            <asp:CheckBox ID="chkActive" runat="server" 
                        Checked='<%# BooleanConverter(Eval("Active")) %>' />
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="chkActive0" runat="server" 
                        Checked='<%# BooleanConverter(Eval("Active")) %>' Enabled="False" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                                      <asp:TemplateField HeaderText="<%$ Resources:SetupFormAuth %>">
                        <EditItemTemplate>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnSetup" runat="server" onclick="lbtnSetup_Click" 
                        Text="<%$ Resources:Setup %>"></asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
            </TServerControl:TGridView>
            <asp:ObjectDataSource ID="ObjectDataSource_Role" runat="server" InsertMethod="BLL_Insert"
        OldValuesParameterFormatString="original_{0}" 
    SelectMethod="BLL_Select" TypeName="BLL_ManageRole" UpdateMethod="BLL_Update" 
                DeleteMethod="BLL_Delete" onupdated="ObjectDataSource_Role_Updated">
                <DeleteParameters>
                    <asp:Parameter Name="original_RoleID" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="original_RoleID" Type="Int32" />
                    <asp:Parameter Name="RoleName" Type="String" />
                    <asp:Parameter Name="RoleDescription" Type="String" />
                    <asp:Parameter Name="Active" Type="String" />
                </UpdateParameters>
                <SelectParameters>
                    <asp:Parameter Name="PapaID" Type="String" />
                    <asp:Parameter Name="Parent" Type="String" />
                </SelectParameters>
                <InsertParameters>
                    <asp:Parameter Name="Parent" Type="Int32" />
                    <asp:Parameter Name="RoleName" Type="String" />
                    <asp:Parameter Name="RoleDescription" Type="String" />
                </InsertParameters>
            </asp:ObjectDataSource>
            <uc1:OpenManageRoleProgramMapping ID="OpenManageRoleProgramMapping1"
        runat="server"  />
            <asp:ValidationSummary ID="sum_Insert" runat="server" DisplayMode="List" 
                ShowMessageBox="True" ShowSummary="False" ValidationGroup="Insert" />
            <asp:ValidationSummary ID="sum_Update" runat="server" DisplayMode="List" 
                ShowMessageBox="True" ShowSummary="False" ValidationGroup="Update" />
</asp:Content>

